import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    redirect: '/shouye',  // 重定向:重新指向其它path,会改变网址
    path: '/'
  },
  {
    path: '/index',
    component: () => import('../page/Index.vue'),
    children: [{
      path: '/shouye',
      title: "首页",
      component: () => import('@/page/Home.vue')
    }, {
      path: '/fenlei',
      title: "分类",
      component: () => import('@/page/Classify.vue')
    }, {
      path: '/gouwuche',
      title: "购物车",
      component: () => import('@/page/Shoppingcar.vue')
    }, {
      path: '/wode',
      title: "我的",
      component: () => import('@/page/My.vue')
    }]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
